package com.seckill.dao;

import com.seckill.entity.Seckill;
import com.seckill.exception.seckillException.SeckillCloseException;
import com.seckill.exception.seckillException.SeckillException;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @Creation_time 2017/9/6
 * @Theme 秒杀商Dao层接口
 * @Autor Xiao Yiyun
 */
public interface SeckillDao {

    //减库存
    public int reduceSeckillCount(
            @Param("seckill_id")int seckill_id,
            @Param("killTime") Date killTime)
            throws SeckillException, SeckillCloseException;
    //根据Id查询秒杀对象
    public Seckill selectSeckillById(
            @Param("seckill_id")int seckill_id) throws Exception;
    //查询所有秒杀对象--传入偏移量
    public List<Seckill> selectAllSeckill(
            @Param("offset")int offset,
            @Param("limit")int limit)
            throws Exception;
    //使用存储过程完成秒杀逻辑
    public void killByProcedure(Map<String, Object> paramMap);
}